{extend name="public/base"}

{block name="title"}算法列表{/block}

{block name="main"}
<!--  搜索添加   -->
<form action="{:url('/alg')}" class="layui-form layui-form-pane">
  <div class="layui-row">
    <div class="layui-col-md2 ">
      <div class="layui-form-item">
        <label for="type" class="layui-form-label">算法类型：</label>
        <div class="layui-input-block">
          <select name="type" id="type" class="custom-select">
            <option selected value="">选择算法类型：</option>
            <option value="1">组合</option>
            <option value="2">杀组合</option>
            <option value="3">反杀组</option>
            <option value="4">大小</option>
            <option value="5">单双</option>
            <option value="6">杀三余</option>
            <option value="7">杀四余</option>
            <option value="8">杀五余</option>
            <option value="9">杀尾数</option>
            <option value="10">中边</option>
          </select>
        </div>
      </div>
    </div>
    <div class="layui-col-md3 ">
      <button class="layui-btn layui-btn-normal">搜索</button>
      <a href="{:url('/alg/create')}" class="layui-btn layui-btn-success">添加算法</a>
    </div>
  </div>
</form>

<!--数据列表-->
<table class="layui-table">
  <thead class="bg-light">
  <tr>
    <th class="text-center">ID</th>
    <th class="text-center">算法名称</th>
    <th class="text-center">算法公式</th>
    <th class="text-center">创建时间</th>
    <th class="text-center">操作</th>
  </tr>
  </thead>
  <tbody>
  {assign name="empty" value='<tr><td colspan="7" class="text-center text-muted">没有数据</td></tr>'}
  {volist name="list" id="obj" empty="$empty"}
  <tr>
    <td class="text-center" style="line-height: 80px">{$obj.id}</td>
    <td class="text-center" style="line-height: 80px">{$obj.name}</td>
    <td class="text-center" style="line-height: 80px">{$obj.alg}</td>
    <td class="text-center" style="line-height: 80px">{$obj.create_at}</td>
    <td class="text-center" style="line-height: 80px">
      <form action="{:url('/alg/'.$obj.id)}" method="post">
        <input type="hidden" name="_method" value="delete">
        <a href="{:url('/alg/'.$obj.id.'/edit')}" class="layui-btn layui-btn-warning layui-btn-sm">修改</a>
        <button class="layui-btn layui-btn-danger layui-btn-sm btn-delete">删除</button>
      </form>
    </td>
  </tr>
  {/volist}
  </tbody>
</table>
<!--分页-->
{/block}

{block name="js"}
<script type="text/javascript">
  $('.btn-delete').click(() => {
    let flag = confirm('您真的要删除这条数据吗？');
    return flag ? true : false;
  });
  $('[data-toggle="tooltip"]').tooltip();
</script>
{/block}
